Release 10.1A: OpenEdge Development:
ADM Reference
Invoking the dynamics call wrapper at the API level
The call wrapper consists of several procedure files with most of the code contained in
caller.p. Thecaller.pfile is derived fromsrc/adm2/smart.p, runs as a persistent procedure and is called as a library. A template procedure is provided as a starting point.A call is broken down into the following phases:
- Setup — consists of creating the Parameter Holder temp-table and populating it with new data. The Parameter Holder temp-table is created by a call to one of these functions:
- Invocation — Before a call can be invoked, a DYNAMIC CALL object is created and properties of the call object are set. The values for these properties are derived from the ttCall temp-table that is defined in the definitions section of
caller.p.ttCallis local to and is not exposed in any form to external procedures. When a call is added to ttCall, it is allocated a call number and this is passed as a parameter to the invoke procedure. The values in the ttCall temp-table record are set by a call during the invokeCall procedure from the input parameters to the procedure. As a result, all the attributes of the DYNAMIC CALL handle can be derived from the ttCall temp-table.- Cleanup — Deletes the ttCall record and the following handles:
Figure A–4 shows the steps you must make to invoke a call at the API level.
Figure A–4: API calls required to invoke a dynamics call
![]()
The calls shown in Figure A–4 illustrate the API calls you need to make to invoke a call:
- Create the Parameter Holder temp-table from the parameters using one of the following: setupTTFromSig, setupTTFromString, or setupTTFromTable.
- Pass the handle to the Parameter Holder temp-table created in the Step 1, along with all the other parameters to invokeCall.
- Use the obtainCallInfo function call to get the required information back on the call. The Parameter Holder temp-table created in Step 1 also contains output parameters and return values.
- Use cleanupCall to delete the call handle and any other handles that were created during the invokeCall. Note that it is possible to only delete certain of the handles.
These steps are illustrated in code Example A–12 through Example A–15. Each of the examples makes a call to the internal procedure PROCEDURE emptyProcParam.
Invoking the dynamics call wrapper at an API level requires that you write more code and is more complicated to implement. However, this method of invoking the dynamic call wrapper provides enhanced performance and more control of error handling and the call handle.
For more information about the APIs used to invoke the dynamics call wrapper, see the "API reference" section.
The code in Example A–12 illustrates the steps necessary to make dynamics calls.
The Parameter Holder temp-table contains a field for each parameter you want to pass. The Parameter Holder temp-table structure contains a field for each parameter and two extra fields:
callReturnValuethat contains the return value from the function or procedure anderrReturnValuethat contains a value only when an error occurs. The data types for the fields are the same as the data type of the parameter being referenced. TheCOLUMN-LABELfor the field contains the data type to be used for the call and the mode of the parameter. For example,INPUT,INPUT-OUTPUT,OUTPUT, orOUTPUT-APPEND.If source parameters are provided to the
setupTTFromcall, the initial values of the temp-table fields are set to the values of the source parameters so that it is not necessary to create a temp-table record in theParameter Holder temp-tableuntil the call is made. When the record is created, the initial value is derived from whatever was set.The code in Example A–13 builds the parameters into a temp-table that is then used to create a parameter temp-table.
The code in Example A–14 illustrates how parameters are derived from the signature and then set.
In Example A–15, the parameters are derived from a string that is passed in to create the dynamics temp-table.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |